#ifndef INC_OBSERVABLE_H
#define INC_OBSERVABLE_H

#include <vector>

class Observer;

// mix-in class
class Observable
{
	public:

		/**
		 * Registers the provided Observer to receive updates. The Observer
		 * should unattach() before it is destroyed, or we may end up with a
		 * dangling pointer.
		 */
		void attach(Observer* o);

		void unattach(Observer* o);

	protected:
		void notifyObservers();

	private:
		std::vector<Observer*> _observers;
};

#endif // INC_OBSERVABLE_H

